/**************************************************************************
 * The reference implementation of the EE122 Project #1
 *
 * Author: Junda Liu (liujd@cs)
 * Author: DK Moon (dkmoon@cs)
 * Author: David Zats (dzats@cs)
**************************************************************************/

#ifndef _constants_h_
#define _constants_h_

#define EE122_VALID_VERSION 4
#define EE122_MAX_NAME_LENGTH 9
#define EE122_SIZE_X 100
#define EE122_SIZE_Y 100
#define EE122_VISION_RANGE 10
#define EE122_MAX_MSG_LENGTH 255

enum messages {
  LOGIN_REQUEST = 1,
  LOGIN_REPLY,
  MOVE,
  MOVE_NOTIFY,
  ATTACK,
  ATTACK_NOTIFY,
  SPEAK,
  SPEAK_NOTIFY,
  LOGOUT,
  LOGOUT_NOTIFY,
  INVALID_STATE,

//  MAX_MESSAGE

  P2P_JOIN_REQUEST = 0x10,
  P2P_JOIN_RESPONSE,
  P2P_BKUP_REQUEST,
  P2P_BKUP_RESPONSE
};

enum UDP_messages {
    STORAGE_LOCATION_REQUEST = 0,
    STORAGE_LOCATION_RESPONSE,
    SERVER_AREA_REQUEST,
    SERVER_AREA_RESPONSE,
    PLAYER_STATE_REQUEST,
    PLAYER_STATE_RESPONSE,
    SAVE_STATE_REQUEST,
    SAVE_STATE_RESPONSE
};

enum direction {NORTH = 0, SOUTH, EAST, WEST};

// Standard input file descriptor
#define STDIN 0
// Maximum input length
#define MAX_INPUT_LEN EE122_MAX_MSG_LENGTH + 7
// Maximum length of packet from server
#define MAX_RECV_LEN 272
// Maximum length of packet to server
#define MAX_SEND_LEN 260
// Maximum size of buffer
#define MAX_BUFFER_SIZE 300
// Maximum length of packet from and to tracker
#define MAX_TRACKER_MSG_LEN 16
// Maximum command length
#define MAX_COMMAND_LEN 6
// Maximum connections allowed
#define MAX_CONNECTIONS 20
// Maximum length of receiving buffer
#define MAX_RECV_BUFFER_LEN 1024
// Largest length of IP address
#define MAX_IP_ADDRESS_LEN 15
// Largest length of line in tracker configuration file
#define MAX_CONFIG_LINE_LEN MAX_IP_ADDRESS_LEN + 15

#endif /* _constants_h_ */
